import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import {resolve} from 'path'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
const customerElements = [
    "chat-message",
    'chat-message-panel',
    'chat-opt-panel',
    'chat-tip',
    'msg-tip',
    'reference-item'
]

export default defineConfig({
    plugins: [
        vue({
            template: {
                compilerOptions: {
                    isCustomElement: tag => customerElements.some(item => item == tag)
                }
            }
        }),
        createSvgIconsPlugin({
            // 指定需要缓存的图标文件夹
            iconDirs: [resolve(process.cwd(), 'src/assets/svg-icon/local')],
            // 指定symbolId格式
            symbolId: `icon-[name]`,
            // 是否压缩
            svgoOptions: true
        })],
    resolve: {
        alias: {
            '@': resolve(__dirname, 'src'),
            '~': resolve(__dirname)
        },
    },
    server: {
        host: '0.0.0.0',
        port: 3206,
        open: true
    },
})